home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
c_lib.arc
/
PCSETBLK.C
< prev
next >
Wrap
Text File
|
1990-08-09
|
2KB
|
52 lines
/**
*
* Name pcsetblk -- Modify an allocated memory block
*
* Synopsis ercode = pcsetblk(seg,size,padsize);
* int ercode Returned DOS function error code
* unsigned seg Segment address of memory block
* unsigned size Requested size of the memory block
* unsigned padsize Returned adjust memory block size
*
* Description pcsetblk adjust the size of the memory block whose
* segment address is specified in seg. The block must
* have been previously allocated either by DOS or by the
* PCALLOC function. The size (in paragraphs) of the block
* is adjusted to the value specified in size. If a grow
* request is made which cannot be satisfied, the largest
* possible expansion is made.
*
* Returns ercode DOS function returned error code
* padsize Adjusted size of the block.
*
* Version 1.0 (C)Copyright Blaise Computing Inc. 1983
*
**/
struct dreg
{
unsigned ax,bx,cx,dx,si,di,ds,es;
};
int pcsetblk(seg,size,padsize)
unsigned seg,size,*padsize;
{
struct dreg dos_reg;
int ercode,dos();
utinit(&dos_reg); /* Initialize registers */
dos_reg.ax = 0x4a00; /* DOS function 4ah */
dos_reg.bx = size;
dos_reg.es = seg;
ercode = dos(&dos_reg);
if (ercode == 8)
*padsize = dos_reg.bx;
else if (ercode == 0)
*padsize = size;
else
*padsize = 0;
return(ercode);
}